import * as React from 'react';
import {connect} from 'react-redux';
import actions from '../../store/actions/Counter';
import * as types from '../../types';

interface Props {
    number: number,
    increment: any,
    decrement: any
}

class Counter extends React.Component<Props> {
    render() {
        let {number, increment, decrement} = this.props
        return (
            <React.Fragment>
                <p>{number}</p>
                <button onClick = {increment}>add</button>
                <button onClick = {decrement}>minus</button>
                {/* <button onClick = {}>toHome</button> */}
            </React.Fragment>
        )
    }
}

export default connect((state:types.Store):types.Counter => {
    return state.Counter
}, actions)(Counter)